package com.loubii.account.db;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.loubii.account.bean.AccountModel;
import com.loubii.account.bean.UserBean;

import com.loubii.account.db.AccountModelDao;
import com.loubii.account.db.UserBeanDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig accountModelDaoConfig;
    private final DaoConfig userBeanDaoConfig;

    private final AccountModelDao accountModelDao;
    private final UserBeanDao userBeanDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        accountModelDaoConfig = daoConfigMap.get(AccountModelDao.class).clone();
        accountModelDaoConfig.initIdentityScope(type);

        userBeanDaoConfig = daoConfigMap.get(UserBeanDao.class).clone();
        userBeanDaoConfig.initIdentityScope(type);

        accountModelDao = new AccountModelDao(accountModelDaoConfig, this);
        userBeanDao = new UserBeanDao(userBeanDaoConfig, this);

        registerDao(AccountModel.class, accountModelDao);
        registerDao(UserBean.class, userBeanDao);
    }
    
    public void clear() {
        accountModelDaoConfig.clearIdentityScope();
        userBeanDaoConfig.clearIdentityScope();
    }

    public AccountModelDao getAccountModelDao() {
        return accountModelDao;
    }

    public UserBeanDao getUserBeanDao() {
        return userBeanDao;
    }

}
